package com.lly;

import com.lly.config.AppConfiguration;
import com.lly.config.ScreensConfiguration;
import com.lly.thread.FFmpegThreadPoolExecutor;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.annotation.PreDestroy;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;


/**
 * Hello world!
 */
@SpringBootApplication(scanBasePackages = "com.lly")
public class FileExplorerApplication extends AbstractJavaFxApplicationSupport {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {

        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfiguration.class);
        ScreensConfiguration screens = context.getBean(ScreensConfiguration.class);
        screens.setPrimaryStage(stage);
        screens.mainDialog().show();
    }


    @PreDestroy
    public void destroy(){
        FFmpegThreadPoolExecutor.shutdownExecutor();
    }
}
